package com.backend.securitiessystem.controller;

import com.backend.securitiessystem.dto.NewShareDto;
import com.backend.securitiessystem.pojo.NewShare;
import com.backend.securitiessystem.result.Result;
import com.backend.securitiessystem.service.NewShareService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 新股 controller
 *
 * @author LWY
 * @date 2024-05-21 03:42:23
 */
@RestController
@Slf4j
public class NewShareController {

    @Resource
    private NewShareService iTbNewShareService;

    @GetMapping("/getNewShareByPage")
    public Result<IPage<NewShareDto>> getNewShareByPage(
            @RequestParam(defaultValue = "2") Integer pageNum,
            @RequestParam(defaultValue = "2") Integer pageSize
    ) {

        QueryWrapper<NewShare> queryWrapper=new QueryWrapper<>();

        IPage<NewShareDto> newShareDtoIPage=iTbNewShareService
                .selectPageWithCondition(pageNum,pageSize,queryWrapper);

        log.info("获取分页数据: {}", newShareDtoIPage);
        return Result.success(newShareDtoIPage);
    }
}
